package com.jzo2o.customer.controller.worker;

import com.jzo2o.customer.model.dto.request.BankAccountUpsertReqDTO;
import com.jzo2o.customer.model.dto.response.BankAccountResDTO;
import com.jzo2o.customer.service.BankAccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController("workerBankAccountController")
@RequestMapping("/worker/bank-account")
@Api(tags = "用户端 - 地址薄相关接口")
public class BankAccountController {

    @Resource
    private BankAccountService bankAccountService;

    @PostMapping
    @ApiOperation("设置或更新银行账户")
    public void setOrUpdateBankAccount(@RequestBody BankAccountUpsertReqDTO bankAccountUpsertReqDTO) {
        bankAccountService.setOrUpdateBankAccount(bankAccountUpsertReqDTO);
    }

    @GetMapping("/currentUserBankAccount")
    @ApiOperation("获取当前用户银行账号")
    public BankAccountResDTO getUserBankAccount() {
        return bankAccountService.getUserBankAccount();
    }
}
